#!/bin/sh


cookie_file="163.cookie"
# 杭州
province=11
city=1
#广州 s=19&c=1
#
username="youraccount@163.com"
password="yourpassword"

islogin=`curl -k -c $cookie_file -d "username=$username&password=$password" "https://reg.163.com/logins.jsp" 2>/dev/null |grep -c '正在登录' `
if [ $islogin -eq 0 ]; then
    echo -e "\033[1;31m登录失败!\033[0m"
    exit 1;
fi
isok=`curl -b $cookie_file -d "content=$1" -d "enableEmotions=1" -d "s=11" -d "c=1" "http://t.163.com/statuses/tweetV2.do" 2>/dev/null |grep -c "$!"`
if [ $isok -eq 0 ]; then
   echo -e "\033[1;31m发表失败!\033[0m"
else
   echo -e "\0033[1;32m发表成功!\033[0m"
fi
